﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ChoViet.CMS.Models;
using ChoViet.Model;
using MVCMessage;

namespace ChoViet.CMS.Controllers
{
    [MessagesFilter(Order = 2)]
    public class BaseController : Controller
    {
        public MessageViewData Messages
        {
            get
            {
                if (!ViewData.ContainsKey("Messages"))
                {
                    throw new InvalidOperationException("Messages are not available. Did you add the MessageFilter attribute to the controller?");
                }
                return (MessageViewData)ViewData["Messages"];
            }
        }   
    }
}
